#include "STC89C5xRC.h"

#define u16 unsigned int
#define u8  unsigned char
#define beep P23 	

void DelayMs(u16 ms);


void main()                                                                                            
{
	u16 i;
	for(i = 2000; i > 0; i--)
	{
		beep = ~beep;
		DelayMs(1);
	}
	for(i = 1000; i > 0; i--)
	{
		beep = ~beep;
		DelayMs(2);
	}
	for(i = 400; i > 0; i--)
	{
		beep = ~beep;
		DelayMs(5);
	}
	for(i = 200; i > 0; i--)
	{
		beep = ~beep;
		DelayMs(10);
	}
	beep = 0;
	DelayMs(2000);
	beep = 1;
	while(1);
}

void DelayMs(u16 ms)
{
	u16 a,b;
	for(a = ms;a > 0;a--)
		for(b = 114;b > 0;b--);
}
